/**
 * 
 */
package zc.fund.num7.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author s1007
 * 
 */
public class DBUtils {

	private static final String CONN_URL = "jdbc:mysql://antsword.eicp.net:3306/costdata";
	private static final String USERNAME = "fundroot";
	private static final String PASSWORD = "123456";

	public Connection getConn() {

		Connection conn = null;

		try {
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection(CONN_URL, USERNAME, PASSWORD);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return conn;

	}

	public void releaseResource(Connection conn, PreparedStatement pstmt,
			ResultSet rset) {

		try {

			if (rset != null)
				rset.close();
			if (pstmt != null)
				pstmt.close();
			if (conn != null)
				conn.close();

		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

}
